/*
 * NewJDialog4.java
 *
 * Created on 7 de octubre de 2008, 16:27
 */

package vista;

import java.awt.Frame;
import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;

/** Form que permite seleccionar las carpetas de interfaz (símil getdir())*/
public class SetupGetDirVista extends javax.swing.JDialog {

	private static final long serialVersionUID = 1L;

	/** Creates new form NewJDialog4 */
    public SetupGetDirVista(java.awt.Frame parent, boolean modal, boolean mostrarSoloDirectorios) {
        super(parent, modal);
        initComponents(mostrarSoloDirectorios);
    }

   SetupGetDirVista(Frame frame) {
      throw new UnsupportedOperationException("Not yet implemented");
   }

   public void setCurrentDirectory(String namefile){
      this.jFileChooser1.setCurrentDirectory(new File(namefile));
   }
   public File getSelected(){
      return this.jFileChooser1.getSelectedFile();
   }

   public void setFileFilter (FileFilter fileFilter){
      this.jFileChooser1.setFileFilter(fileFilter);
   }
   
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     * @param mostrarSoloDirectorios 
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents(boolean mostrarSoloDirectorios) {

    	int fileSelectionMode = mostrarSoloDirectorios ? JFileChooser.DIRECTORIES_ONLY : JFileChooser.FILES_AND_DIRECTORIES;
        jFileChooser1 = new javax.swing.JFileChooser();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("");
        setModal(true);
        getContentPane().setLayout(null);

        jFileChooser1.setAcceptAllFileFilterUsed(false);
        jFileChooser1.setCurrentDirectory(new java.io.File("c:\\"));
            jFileChooser1.setFileSelectionMode(fileSelectionMode);
            jFileChooser1.setOpaque(true);
            jFileChooser1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jFileChooser1ActionPerformed(evt);
                }
            });
            getContentPane().add(jFileChooser1);
            jFileChooser1.setBounds(0, 0, 510, 300);

            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-520)/2, (screenSize.height-326)/2, 520, 326);
        }// </editor-fold>//GEN-END:initComponents

private void jFileChooser1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFileChooser1ActionPerformed
// TODO add your handling code here:
   this.dispose();
}//GEN-LAST:event_jFileChooser1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFileChooser jFileChooser1;
    // End of variables declaration//GEN-END:variables

    public JFileChooser getJFileChooser1(){
    	return this.jFileChooser1;
    }
}
